home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / comms / other / novia / bin / login.c < prev    next >
C/C++ Source or Header  |  1999-12-06  |  1KB  |  44 lines

  1. #include <pragma/noviasys_lib.h>
  2. #include <pragma/exec_lib.h>
  3. #include <pragma/dos_lib.h>
  4. #include <stdio.h>
  5. #include <novia/novia_portdata.h>
  6.  
  7. struct Library *NoviaSysBase;
  8.  
  9. void ioprintf(const char *string, ...)
  10. {
  11.     char *buffer=AllocVec(10000,MEMF_ANY|MEMF_CLEAR);
  12.     if (buffer)
  13.     {
  14.         vsprintf(buffer, string, unsigned int(&string + 1));
  15.         Writeio(buffer,-1);
  16.         FreeVec(buffer);
  17.     }
  18. }
  19.  
  20. void main()
  21. {
  22.     if ((NoviaSysBase = OpenLibrary("noviasys.library", 0)))
  23.     {
  24.         struct PortData *cport = (struct PortData *)FindTask(NULL)->tc_UserData;
  25.             ioprintf("\nLogin Username:> ");
  26.             Getstring(buffer,0,20,0,0);
  27.             if ((ulong=SearchUser(buffer)))
  28.             {
  29.                 ndos_saveselectlist((List *)&cport->select_list);
  30.                 ioprintf("load user\n");
  31.                 LoadUser(&cport->LocalUser,ulong);
  32.  
  33.                 ioprintf("\nPassword      :> ");
  34.                 ioprintf("\nCurrent User is :%s (%d)\n",cport->LocalUser.Handle,ulong);
  35.                 ndos_loadselectlist((List *)&cport->select_list);
  36.                 ndos_getlist();
  37.             }
  38.             else
  39.             {
  40.                 ioprintf("\nunknown User: %s \n",buffer);
  41.             }
  42.         CloseLibrary(NoviaSysBase);
  43.     }
  44. }